apiready = function() {

	$("#subchangepw").on('click', function() {
		var oldpw = $("#oldpw").val();
		var newpw = $("#newpw").val();

		if (!oldpw || !newpw) {
			$api.toastMsg("密码不能为空");
			return;
		}
		$api.getUserInf(function(user) {
			var account = user.account;


			$api.do_post("/api/commuser/changePWD", {
				body: JSON.stringify({
					password: oldpw,
					newpassword: newpw,
					account: account
				})
			}, function(result) {
				if (result.code == 0) {
				
						api.confirm({
							msg: result.msg,
							buttons: ['确定', '取消']
						}, function(ret, err) {
							if (ret) {

								api.closeWin();
							} else {
								alert(result.msg);
							}
						});

				} else {
					$api.toastMsg(result.msg);
				}

			});


		});



	});

}